﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/MenuMaster.Master" AutoEventWireup="true" CodeBehind="EditEvent.aspx.cs" Inherits="Department.admin.Content.EditEvent" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div id="page-heading">
        <h1>Редакция на събитие</h1>
    </div>
    <table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
        <tr>
            <th rowspan="3" class="sized">
                <img src="../images/shared/side_shadowleft.jpg" width="20" height="300" alt="" />
            </th>
            <th class="topleft">
            </th>
            <td id="tbl-border-top">
                &nbsp;
            </td>
            <th class="topright">
            </th>
            <th rowspan="3" class="sized">
                <img src="../images/shared/side_shadowright.jpg" width="20" height="300" alt="" />
            </th>
        </tr>
        <tr>
            <td id="tbl-border-left">
            </td>
            <td>
                <!--  start content-table-inner -->
                <div id="content-table-inner">
                    <table border="0" width="100%" cellpadding="0" cellspacing="0">
                        <tr valign="top">
                            <td>
                                <!--  start step-holder -->
                                <!--  end step-holder -->
                                <!-- start id-form -->
                                <table border="0" cellpadding="0" cellspacing="0" id="id-form">
                                    <tr>
                                        <th valign="top">
                                            Заглавие:
                                        </th>
                                        <td class="style2">
                                            <asp:TextBox ID="headingTextBox" runat="server" CssClass="inp-form" 
                                                Width="189px" />
                                            <asp:RegularExpressionValidator ID="regExValidator"
                                                ControlToValidate="headingTextBox"
                                                ValidationExpression="[a-zA-Zа-яА-Я0-9._\s]+"
                                                ErrorMessage="Използвате непозволени символи!"
                                                runat="server" />
                                            <asp:RequiredFieldValidator ID="rqFieldValidator"
                                                ControlToValidate="headingTextBox"
                                                ErrorMessage="Полето е задължително!"
                                                runat="server" />
                                        </td>
                                       
                                    </tr>
                                    <tr>
                                        <th valign="top">
                                            Скрито:
                                        </th>
                                        <td class="style2">
                                            <asp:CheckBox ID="checkboxActive" runat="server" />
                                           
                                        </td>
                                      
                                    </tr>
                                    <tr>
                                        <th valign="top">
                                            Дата на публикуване:
                                        </th>
                                        <td class="style2">
                                             <asp:TextBox ID="publishDateTextBox" runat="server" CssClass="inp-form" 
                                                Width="189px" />
                                           <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="publishDateTextBox"
                                                ErrorMessage="Полето е задължително!" runat="server" />
                                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationExpression="(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d"
                                              ErrorMessage="Въвели сте грешна дата."  ControlToValidate="publishDateTextBox"></asp:RegularExpressionValidator>
                                        </td>
                                       
                                    </tr>
                                    <tr>
                                        <th valign="top">
                                            Дата на събитието:
                                        </th>
                                        <td class="style2">
                                             <asp:TextBox ID="eventDateTextBox" runat="server" CssClass="inp-form" 
                                                Width="189px" />
                                           <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="eventDateTextBox"
                                                ErrorMessage="Полето е задължително!" runat="server" />
                                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ValidationExpression="(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d"
                                              ErrorMessage="Въвели сте грешна дата."  ControlToValidate="eventDateTextBox"></asp:RegularExpressionValidator>
                                        </td>
                                      
                                    </tr>
                                    <tr>
                                        <th valign="top">
                                            Текст:
                                        </th>
                                        <td class="style2">
                                            <CKEditor:CKEditorControl ID="CKEditor" runat="server" Height="203px" Width="578px">
		
                                            </CKEditor:CKEditorControl>
                                        </td>
                                        <td class="style1">
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>
                                            Качени файлове:
                                        </th>
                                        <td class="style2">
                                            <table border="0" cellpadding="0" cellspacing="0" id="product-table">
                                                <tr>
                                                    
                                                    <th class="table-header-repeat line-left minwidth-1">
                                                        <asp:LinkButton ID="sortByName" OnCommand="sortByHeading_Click" CommandArgument="Name"
                                                            runat="server">Име</asp:LinkButton>
                                                    </th>
                                                    <th class="table-header-repeat line-left minwidth-1">
                                                        <asp:LinkButton ID="sortByMenuName" OnCommand="sortByHeading_Click" CommandArgument="MenuName"
                                                            runat="server">Описание</asp:LinkButton>
                                                    </th>
                                                    
                                                    <th class="table-header-options line-left">
                                                        <a href="">Действия</a>
                                                    </th>
                                                </tr>
                                              
                                                <asp:ListView ID="itemsView" runat="server" DataSourceID="uploadedFiles">
                                                    <ItemTemplate>
                                                        <tr style="">
                                                           
                                                            <td align="center">
                                                                <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                                                            </td>
                                                            <td align="center">
                                                                <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>' />
                                                            </td>
                                                           
                                                            <td class="options-width" align="center">
                                                                <asp:HyperLink ID="Edit" title="Редактирай" class="icon-1 info-tooltip" runat="server"
                                                                    NavigateUrl='<%#"/admin/SiteStructure/EditPages.aspx?id=" + DataBinder.Eval(Container.DataItem,"ID")%>'>
                                                                </asp:HyperLink>
                                                                <asp:LinkButton ID="deleteButton" title="Премахни файл." OnCommand="markInactiveButton_Click" CommandArgument='<%#Eval("ID") %>' runat="server" class="icon-2 info-tooltip"></asp:LinkButton>
                                                               <asp:Label Visible="false" ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                                                            </td>
                                                        </tr>
                                                    </ItemTemplate>
                                                    <AlternatingItemTemplate>
                                                        <tr style="" class="alternate-row">
                                                           
                                                            <td align="center">
                                                                <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                                                            </td>
                                                            <td align="center">
                                                                <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>' />
                                                            </td>
                                                           
                                                            <td class="options-width" align="center">
                                                            <asp:HyperLink ID="Edit" title="Редактирай" class="icon-1 info-tooltip" runat="server"
                                                                    NavigateUrl='<%#"/admin/SiteStructure/EditPages.aspx?id=" + DataBinder.Eval(Container.DataItem,"ID")%>'>
                                                                </asp:HyperLink>
                                                                <asp:LinkButton ID="deleteButton" title="Премахни файл." OnCommand="markInactiveButton_Click" CommandArgument='<%#Eval("ID") %>' runat="server" class="icon-2 info-tooltip"></asp:LinkButton>
                                                               <asp:Label Visible="false" ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                                                            </td>
                                                        </tr>
                                                    </AlternatingItemTemplate>
                                                </asp:ListView>
                                            </table>
                                            <asp:DataPager ID="DataPagerListView" runat="server" PageSize="10" PagedControlID="itemsView">
                                                <Fields>
                                                    <asp:NumericPagerField ButtonType="Link" NextPageText="" PreviousPageText="" ButtonCount="999999" />
                                                </Fields>
                                            </asp:DataPager>
                                            <asp:SqlDataSource ID="uploadedFiles" runat="server" ConnectionString="<%$ ConnectionStrings:DepartmentConnectionString %>"
                                                DeleteCommand="DELETE FROM DocumentsForEvents
                                                FROM            DocumentsForEvents INNER JOIN
                                                                         Documents ON DocumentsForEvents.EventID = Documents.ID
                                                WHERE        DocID = @DocID
                                                                             DELETE FROM Documents
                                                WHERE        ID = @DocID" SelectCommand="SELECT Left(Documents.Name,25) AS Name, Left(Documents.Description,25) AS Description, Documents.ID FROM Documents INNER JOIN DocumentsForEvents ON Documents.ID = DocumentsForEvents.DocID WHERE (DocumentsForEvents.EventID = @ID)"
                                                
                                                
                                                
                                                UpdateCommand="UPDATE Documents SET Name = @Name, Description = @Description, Date = @Date WHERE (ID = @ID)">
                                                <DeleteParameters>
                                                    <asp:Parameter Name="DocID" />
                                                </DeleteParameters>
                                                <SelectParameters>
                                                    <asp:QueryStringParameter Name="ID" QueryStringField="ID" />
                                                </SelectParameters>
                                                <UpdateParameters>
                                                    <asp:Parameter Name="Name" />
                                                    <asp:Parameter Name="Description" />
                                                    <asp:Parameter Name="Date" />
                                                    <asp:Parameter Name="ID" />
                                                </UpdateParameters>
                                            </asp:SqlDataSource>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>
                                            Файл 1:
                                        </th>
                                        <td class="style2">
                                                <asp:FileUpload id="FileUploadControl" runat="server" />
                                        </td>
                                        <td class="style1">
                                            <div class="bubble-left">
                                            </div>
                                            <div class="bubble-inner">
                                                10MB max per file</div>
                                            <div class="bubble-right">
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>
                                            Файл 2:
                                        </th>
                                        <td class="style2">
                                            <asp:FileUpload id="FileUploadControl2" runat="server" />
                                        </td>
                                        <td class="style1">
                                            <div class="bubble-left">
                                            </div>
                                            <div class="bubble-inner">
                                                10MB max per file</div>
                                            <div class="bubble-right">
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>
                                            Файл 3:
                                        </th>
                                        <td class="style2">
                                           <asp:FileUpload id="FileUploadControl3" runat="server" />
                                        </td>
                                        <td class="style1">
                                            <div class="bubble-left">
                                            </div>
                                            <div class="bubble-inner">
                                                10MB max per file</div>
                                            <div class="bubble-right">
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>
                                            &nbsp;
                                        </th>
                                        <td valign="top" class="style2">
                                            <asp:Button ID="buttonSubmit" runat="server" Text="Button" 
                                                CssClass="form-submit" OnClick="buttonSubmit_Click" />
                                        </td>
                                        <td class="style1">
                                        </td>
                                    </tr>
                                </table>
                                <!-- end id-form  -->
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <img src="../images/shared/blank.gif" width="695" height="1" alt="blank" />
                            </td>
                            <td>
                            </td>
                        </tr>
                    </table>
                    <div class="clear">
                    </div>
                </div>
                <!--  end content-table-inner  -->
            </td>
            <td id="tbl-border-right">
            </td>
        </tr>
        <tr>
            <th class="sized bottomleft">
            </th>
            <td id="tbl-border-bottom">
                &nbsp;
            </td>
            <th class="sized bottomright">
            </th>
        </tr>
    </table>
</asp:Content>
